function sgAddEvent(element, eventName, fn) { if (element.addEventListener) element.addEventListener(eventName, fn, false); else if (element.attachEvent) element.attachEvent('on' + eventName, fn); } /*Popup order count*/ window.SGPB_ORDER = 0; function SGPBPopup() { this.id = null; this.eventName = ''; this.popupData = null; this.additionalPopupData = {}; this.popupConfig = {}; this.popupObj = null; this.onceListener(); this.initialsListeners(); this.countPopupOpen = true; this.closeButtonDefaultPositions = {}; this.closeButtonDefaultPositions[1] = { 'left': 9, 'right': 9, 'bottom': 9 }; this.closeButtonDefaultPositions[2] = { 'left': 0, 'right': 0, 'top': parseInt('-20'), 'bottom': parseInt('-20') }; this.closeButtonDefaultPositions[3] = { 'right': 4, 'bottom': 4, 'left': 4, 'top': 4 }; this.closeButtonDefaultPositions[4] = { 'left': 12, 'right': 12, 'bottom': 9 }; this.closeButtonDefaultPositions[5] = { 'left': 8, 'right': 8, 'bottom': 8 }; this.closeButtonDefaultPositions[6] = { 'left': parseInt('-18.5'), 'right': parseInt('-18.5'), 'bottom': parseInt('-18.5'), 'top': parseInt('-18.5') }; } SGPBPopup.htmlCustomButton = function() { var buttons = jQuery('.sgpb-html-custom-button'); var buttonActionBehaviors = function(button, settings) { button.bind('click', function() { var behavior = settings['sgpb-custom-button']; if (behavior === 'redirectToURL') { if (settings['sgpb-custom-button-redirect-new-tab']) { window.open(settings['sgpb-custom-button-redirect-URL']); } else { window.location.href = settings['sgpb-custom-button-redirect-URL']; } } if (behavior === 'hidePopup') { SGPBPopup.closePopup(); } if (behavior === 'copyToClipBoard') { var textAreaId = 1; var value = settings['sgpb-custom-button-copy-to-clipboard-text']; var textArea = jQuery('